# -*- coding:utf-8 -*-

import redis


class Config(object):
    '''项目的配置'''
    SECRET_KEY = '9q/l42GDXXBtNfqLQOTscmhoDNrqsNQlWHmw5EZmTzlaXhHrhJw84eYkrASBZVfY'

    # 数据库连接信息配置
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/ihome17"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # Session 扩展的配置
    SESSION_TYPE = "redis"  # 存储类型
    SESSION_REDIS = redis.StrictRedis(
        host=REDIS_HOST,
        password='',
        port=REDIS_PORT,
        db=2)
    SESSION_USE_SIGNER = True  # 是否签名
    PERMANENT_SESSION_LIFETIME = 86400  # 生命周期


class DevelopmentConfig(Config):
    '''开发阶段所需要的配置'''
    # 开启调试模式
    DEBUG = True


class ProductionConfig(Config):
    '''生产环境下所需要的配置'''
    REDIS_PASSWD = ''

config = {
    "development": DevelopmentConfig,
    "production": ProductionConfig
}
